#ifdef __cplusplus
   extern "C" {
#endif

#define BST_IN_RAM   0x0010
#define BST_IN_EPROM 0x0020


/***************************************************************************/
/* typedef for addess table    max 16 connections                          */
/***************************************************************************/
#pragma pack(1)
typedef struct 
	{
	unsigned char  adr;          /* stationsadresse     default 2          */
	unsigned char  segmentid;    /* segment id          default 0          */
	unsigned char  slotno;       /* slot no             default 1          */
	unsigned char  rackno;       /* rack no             default 0          */
	} adr_table_type;
#pragma pack()
/***************************************************************************/
/* connection no, device_name, connection adress table */
int WINAPI load_tool(char,char *,adr_table_type *);
int WINAPI unload_tool(void);
/* connection no */
int WINAPI new_ss(char);


/*************************************************************************/
/**************************************************************************/
// functions for AS300
/**************************************************************************/
/*************************************************************************/
int WINAPI ag_info(char *);
int WINAPI ag_zustand(char *);
/*************************************************************************/
/* blockno, no, amount, buffer */
int WINAPI db_read(int,int,int*,void *);
int WINAPI db_write(int,int,int*,void *);
int WINAPI d_field_read(int,int,int,void *);
int WINAPI d_field_write(int,int,int,void *);
/*************************************************************************/
/* no, amount, buffer */
int WINAPI e_field_read(int,int,void *);
int WINAPI a_field_read(int,int,void *);
int WINAPI m_field_read(int,int,void *);
int WINAPI t_field_read(int,int,void *);
int WINAPI z_field_read(int,int,void *);
int WINAPI a_field_write(int,int,void *);
int WINAPI m_field_write(int,int,void *);
int WINAPI z_field_write(int,int,void *);
/*************************************************************************/
/* buffer */
int WINAPI db_buch(void *);
/*************************************************************************/
/* data field, buffer */
int WINAPI mix_read(char*,void*);
int WINAPI mix_write(char*,void*);
/*************************************************************************/
/* no, bitno */
int WINAPI mb_setbit(int,int);
int WINAPI mb_resetbit(int,int);
/* no, bitno, value */
int WINAPI mb_bittest(int,int,char *);
/*************************************************************************/

/************************************************************************/
/**************************************************************************/
// functions for AS200
/**************************************************************************/
/**************************************************************************/
// no, amount, value
int WINAPI as200_e_field_read(int,int,void*);
int WINAPI as200_a_field_read(int,int,void*);
int WINAPI as200_m_field_read(int,int,void*);
int WINAPI as200_t_field_read(int,int,void*);
int WINAPI as200_z_field_read(int,int,void*);
int WINAPI as200_sm_field_read(int,int,void*);
int WINAPI as200_vs_field_read(int,int,void*);
int WINAPI as200_a_field_write(int,int,void*);
int WINAPI as200_m_field_write(int,int,void*);
int WINAPI as200_z_field_write(int,int,void*);
int WINAPI as200_sm_field_write(int,int,void*);
int WINAPI as200_vs_field_write(int,int,void*);
// data, value
int WINAPI as200_mix_read(char*,void*);
int WINAPI as200_mix_write(char*,void*);
// no, bitno
int WINAPI as200_mb_setbit(int,int);                 /* no, bitno                  */
int WINAPI as200_mb_resetbit(int,int);               /* no, bitno                  */
// no, bitno, value
int WINAPI as200_mb_bittest(int,int,void *);         /* no, bitno, value           */
// value
int WINAPI as200_ag_info(void*);
int WINAPI as200_ag_zustand(void*);
/**************************************************************************/
// functions for AS200
/**************************************************************************/





/*************************************************************************/
/*************************************************************************/
// Teleservice functions
/*************************************************************************/
/*************************************************************************/
#define TS_CONNECTED	0x00000001
#define TS_DISCONNECTED 0x00000003


//dial via modem, asynchronous dial if handle
//modem name, standort name, tel.no, username, password , window handel, message, wparam,NULL 
int WINAPI ts_dial(char*,char*,char*,char*,char*,HANDLE,UINT,WPARAM,char*);

//disconnect dial connection
int WINAPI ts_hang_up_dial(void);

//set indicaton on ring -> message if ts-adapter is connected
// modem name, no of rings, window handel, message, wparam,NULL 
int WINAPI ts_set_ringindicator(char*,int,HANDLE,UINT,WPARAM,char*);

// information from ring connected ts-adapter   
// eventid (16 bytes) , asid (1 byte)
int WINAPI ts_read_info(void *,unsigned char *);

//disconnect ring connection
int WINAPI ts_hang_up_ring(void);

// get names of all system known modems
// ModemID 0..n, ptr ModemName, ptr ModemNameBufferLen
int WINAPI ts_get_modem_name(int,char*,int*);


#ifdef __cplusplus
    } /* extern "C" */
#endif
